package baidu;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class GzFile {

	private static long ipToLong(String ip) {
		String[] cols = ip.split("\\.");
		int result = 0;
		result |= (Integer.parseInt(cols[0]) << 24) & 0xFF000000;
		result |= (Integer.parseInt(cols[1]) << 16) & 0xFF0000;
		result |= (Integer.parseInt(cols[2]) << 8) & 0xFF00;
		result |= Integer.parseInt(cols[3]) & 0xFF;
		return result;
	}

	public static String longToIp(long ip) {
		return ((ip >> 24) & 0xFF) 
				+ "." 
				+ ((ip >> 16) & 0xFF) 
				+ "."
				+ ((ip >> 8) & 0xFF) 
				+ "." 
				+ (ip & 0xFF);
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new FileReader("D:/ssn_log/tmp_1.txt"));
		 String line = null;
//		System.out.println(ipToLong("220.181.38.112"));
//		System.out.println(longToIp(ipToLong("220.181.38.112")));
	}

}
